# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[return lang[:2].lower()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770dc4c>}
nname: 184
n 184(None)[t.install(unicode=True, names=['ngettext'])
return None
]:
	i: 100(JA), 151(JA), 180(), 183()
	o: 

nname: 183
n 183(None)[]:
	i: 34(f)
	o: 184()

nname: 180
n 180(None)[]:
	i: 178(AE)
	o: 184()

nname: 178
n 178(None)[]:
	i: 141(f)
	o: 180(AE)

nname: 151
n 151(None)[log.error("language '%s' not available", language)
return False
]:
	i: 141(t)
	o: 184(JA)

nname: 141
n 141(<dummy_ex3> EXC_MATCH IOError)[]:
	i: 76(except)
	o: 151(t), 178(f)

nname: 100
n 100(None)[t = gettext.translation(application, locale_dir, languages=[dir_name])
available_languages[iso_code] = t
]:
	i: 76(try)
	o: 184(JA)

nname: 76
n 76(None)[dir_name = iso_code + '_' + iso_code.upper()
]:
	i: 34(t)
	o: 100(try), 141(except)

nname: 34
n 34(t is None)[language = lang
iso_code = iso(language)
t = available_languages.get(iso_code)
]:
	i: 0(t), 22()
	o: 76(t), 183(f)

nname: 22
n 22(None)[]:
	i: 0(f)
	o: 34()

nname: 0
n 0(lang)[from pygui.config import user_config
]:
	i: 
	o: 22(f), 34(t)

nname: 184
n 184(None)[t.install(unicode=True, names=['ngettext'])
return None
]:
	i: 100(JA), 151(JA), 141(f), 178(AE), 0(f)
	o: 

nname: 151
n 151(None)[log.error("language '%s' not available", language)
return False
]:
	i: 141(t)
	o: 184(JA)

nname: 141
n 141(<dummy_ex3> EXC_MATCH IOError)[]:
	i: 76(except)
	o: 151(t), 184(f)

nname: 100
n 100(None)[t = gettext.translation(application, locale_dir, languages=[dir_name])
available_languages[iso_code] = t
]:
	i: 76(try)
	o: 184(JA)

nname: 76
n 76(None)[dir_name = iso_code + '_' + iso_code.upper()
]:
	i: 0(t)
	o: 100(try), 141(except)

nname: 0
n 0(t is None)[from pygui.config import user_config
if not lang:
	pass
language = lang
iso_code = iso(language)
t = available_languages.get(iso_code)
]:
	i: 
	o: 76(t), 184(f)

nname: 184
n 184(None)[t.install(unicode=True, names=['ngettext'])
return None
]:
	i: 141(f), 0(f)
	o: 

nname: 141
n 141(None)[except IOError:
	log.error("language '%s' not available", language)
	return False
]:
	i: 76()
	o: 184(JA)

nname: 76
n 76(None)[dir_name = iso_code + '_' + iso_code.upper()
try:
	t = gettext.translation(application, locale_dir, languages=[dir_name])
	available_languages[iso_code] = t
]:
	i: 0(t)
	o: 141()

nname: 0
n 0(t is None)[from pygui.config import user_config
if not lang:
	pass
language = lang
iso_code = iso(language)
t = available_languages.get(iso_code)
]:
	i: 
	o: 76(t), 184(f)

nname: 184
n 184(None)[t.install(unicode=True, names=['ngettext'])
return None
]:
	i: 76(f), 0(f)
	o: 

nname: 76
n 76(None)[dir_name = iso_code + '_' + iso_code.upper()
try:
	t = gettext.translation(application, locale_dir, languages=[dir_name])
	available_languages[iso_code] = t
except IOError:
	log.error("language '%s' not available", language)
	return False
]:
	i: 0(t)
	o: 184(JA)

nname: 0
n 0(t is None)[from pygui.config import user_config
if not lang:
	pass
language = lang
iso_code = iso(language)
t = available_languages.get(iso_code)
]:
	i: 
	o: 76(t), 184(f)

nname: 0
n 0(None)[from pygui.config import user_config
if not lang:
	pass
language = lang
iso_code = iso(language)
t = available_languages.get(iso_code)
if t is None:
	dir_name = iso_code + '_' + iso_code.upper()
	try:
		t = gettext.translation(application, locale_dir, languages=[dir_name])
		available_languages[iso_code] = t
	except IOError:
		log.error("language '%s' not available", language)
		return False
t.install(unicode=True, names=['ngettext'])
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7709ecc>}
nname: 0
n 0(None)[gettext.install(application, locale_dir, unicode=True, names=['ngettext'])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770ddcc>}
nname: 67
n 67(None)[return unicode(txt)
]:
	i: 15(), 38(), 57()
	o: 

nname: 57
n 57(None)[]:
	i: 22(f)
	o: 67()

nname: 38
n 38(None)[]:
	i: 22(t)
	o: 67()

nname: 22
n 22(isinstance(txt, basestring))[]:
	i: 0(f)
	o: 38(t), 57(f)

nname: 15
n 15(None)[]:
	i: 0(t)
	o: 67()

nname: 0
n 0(isinstance(txt, unicode))[]:
	i: 
	o: 15(t), 22(f)

nname: 0
n 0(None)[if isinstance(txt, unicode):
	pass
else:
	if isinstance(txt, basestring):
		pass
return unicode(txt)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770906c>}
nname: 110
n 110(None)[]:
	i: 83(), 87()
	o: 

nname: 87
n 87(None)[return _(dict.__getitem__(self, key))
]:
	i: 0&15(f)
	o: 110()

nname: 83
n 83(None)[return dict.__getitem__(self, key[4:])
]:
	i: 44(), 63()
	o: 110()

nname: 63
n 63(None)[]:
	i: 31(f)
	o: 83()

nname: 44
n 44(None)[]:
	i: 31(t)
	o: 83()

nname: 31
n 31(key in self)[]:
	i: 0&15(t)
	o: 44(t), 63(f)

nname: 0&15
n 0&15(isinstance(key, basestring) and key.startswith('raw_'))[]:
	i: 
	o: 31(t), 87(f)

nname: 110
n 110(None)[]:
	i: 31(), 87()
	o: 

nname: 87
n 87(None)[return _(dict.__getitem__(self, key))
]:
	i: 0&15(f)
	o: 110()

nname: 31
n 31(None)[if key in self:
	pass
return dict.__getitem__(self, key[4:])
]:
	i: 0&15(t)
	o: 110()

nname: 0&15
n 0&15(isinstance(key, basestring) and key.startswith('raw_'))[]:
	i: 
	o: 31(t), 87(f)

nname: 0&15
n 0&15(None)[if isinstance(key, basestring) and key.startswith('raw_'):
	if key in self:
		pass
	return dict.__getitem__(self, key[4:])
else:
	return _(dict.__getitem__(self, key))
]:
	i: 
	o: 

self.nodes: {'0&15': <unpyclib.structure.node instance at 0xb7709d2c>}
nname: 119
n 119(None)[]:
	i: 89(), 93()
	o: 

nname: 93
n 93(None)[return _(dict.get(self, key, default))
]:
	i: 0&15(f)
	o: 119()

nname: 89
n 89(None)[return dict.get(self, key[4:], default)
]:
	i: 44(), 66()
	o: 119()

nname: 66
n 66(None)[]:
	i: 31(f)
	o: 89()

nname: 44
n 44(None)[]:
	i: 31(t)
	o: 89()

nname: 31
n 31(key in self)[]:
	i: 0&15(t)
	o: 44(t), 66(f)

nname: 0&15
n 0&15(isinstance(key, basestring) and key.startswith('raw_'))[]:
	i: 
	o: 31(t), 93(f)

nname: 119
n 119(None)[]:
	i: 31(), 93()
	o: 

nname: 93
n 93(None)[return _(dict.get(self, key, default))
]:
	i: 0&15(f)
	o: 119()

nname: 31
n 31(None)[if key in self:
	pass
return dict.get(self, key[4:], default)
]:
	i: 0&15(t)
	o: 119()

nname: 0&15
n 0&15(isinstance(key, basestring) and key.startswith('raw_'))[]:
	i: 
	o: 31(t), 93(f)

nname: 0&15
n 0&15(None)[if isinstance(key, basestring) and key.startswith('raw_'):
	if key in self:
		pass
	return dict.get(self, key[4:], default)
else:
	return _(dict.get(self, key, default))
]:
	i: 
	o: 

self.nodes: {'0&15': <unpyclib.structure.node instance at 0xb7709a4c>}
nname: 48
n 48(None)[del _[1]
return self.keys()
]:
	i: 0(AF), 20()
	o: 

nname: 20
n 20(None)[for k in self.keys():
]:
	i: 0(for)
	o: 48()

nname: 0
n 0(None)[]:
	i: 
	o: 20(for), 48(AF)

self.nodes: {0: <unpyclib.structure.node instance at 0xb77093ec>, 48: <unpyclib.structure.node instance at 0xb77098ec>, 20: <unpyclib.structure.node instance at 0xb770966c>}
nname: 6
n 6(None)[__doc__ = "\n    Dict that handle (key : i18n value).\n    All the values are evaluated (ie i18n'ed) at each dict access\n    "
def __getitem__(self, key):
	if isinstance(key, basestring) and key.startswith('raw_'):
		if key in self:
			pass
		return dict.__getitem__(self, key[4:])
	else:
		return _(dict.__getitem__(self, key))

def get(self, key, default=None):
	if isinstance(key, basestring) and key.startswith('raw_'):
		if key in self:
			pass
		return dict.get(self, key[4:], default)
	else:
		return _(dict.get(self, key, default))

def items(self):
	pass

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb770decc>}
nname: 0
n 0(None)[df = user_config['base']['dateformat']
return _DATE_FORMAT_MAPPING.get(df, '%Y/%m/%d')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770df6c>}
nname: 25
n 25(None)[return '%I:%M %p'
]:
	i: 14(), 21()
	o: 

nname: 21
n 21(None)[]:
	i: 0(f)
	o: 25()

nname: 14
n 14(None)[]:
	i: 0(t)
	o: 25()

nname: 0
n 0(user_config['base']['timeformat'])[]:
	i: 
	o: 14(t), 21(f)

nname: 0
n 0(None)[if user_config['base']['timeformat']:
	pass
return '%I:%M %p'
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770de0c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from pygui.config import locale_dir, user_config
from peewee.debug import GET_LOGGER
import gettext
log = GET_LOGGER(__name__)
application = 'messages'
def iso(lang):
	return lang[:2].lower()

available_languages = dict()
def set_language(lang=None):
	from pygui.config import user_config
	if not lang:
		pass
	language = lang
	iso_code = iso(language)
	t = available_languages.get(iso_code)
	if t is None:
		dir_name = iso_code + '_' + iso_code.upper()
		try:
			t = gettext.translation(application, locale_dir, languages=[dir_name])
			available_languages[iso_code] = t
		except IOError:
			log.error("language '%s' not available", language)
			return False
	t.install(unicode=True, names=['ngettext'])
	return None

def init():
	gettext.install(application, locale_dir, unicode=True, names=['ngettext'])

init()
log.info(_('Internationalisation loaded.'))
def omnicode(txt):
	if isinstance(txt, unicode):
		pass
	else:
		if isinstance(txt, basestring):
			pass
	return unicode(txt)

class UnicodeDict(dict):
	__doc__ = "\n    Dict that handle (key : i18n value).\n    All the values are evaluated (ie i18n'ed) at each dict access\n    "
	def __getitem__(self, key):
		if isinstance(key, basestring) and key.startswith('raw_'):
			if key in self:
				pass
			return dict.__getitem__(self, key[4:])
		else:
			return _(dict.__getitem__(self, key))

	def get(self, key, default=None):
		if isinstance(key, basestring) and key.startswith('raw_'):
			if key in self:
				pass
			return dict.get(self, key[4:], default)
		else:
			return _(dict.get(self, key, default))

	def items(self):
		pass



Y_M_D, D_M_Y, M_D_Y = xrange(3)
_DATE_FORMAT_MAPPING = {Y_M_D: '%Y/%m/%d', D_M_Y: '%d/%m/%Y', M_D_Y: '%m/%d/%Y'}
def get_date_format():
	df = user_config['base']['dateformat']
	return _DATE_FORMAT_MAPPING.get(df, '%Y/%m/%d')

def get_time_format():
	if user_config['base']['timeformat']:
		pass
	return '%I:%M %p'

__all__ = ['set_language', 'available_languages', 'omnicode', 'UnicodeDict', 'get_date_format', 'get_time_format', 'Y_M_D', 'D_M_Y', 'M_D_Y']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7705a4c>}
from __future__ import absolute_import
from pygui.config import locale_dir, user_config
from peewee.debug import GET_LOGGER
import gettext
log = GET_LOGGER(__name__)
application = 'messages'
def iso(lang):
	return lang[:2].lower()

available_languages = dict()
def set_language(lang=None):
	from pygui.config import user_config
	if not lang:
		pass
	language = lang
	iso_code = iso(language)
	t = available_languages.get(iso_code)
	if t is None:
		dir_name = iso_code + '_' + iso_code.upper()
		try:
			t = gettext.translation(application, locale_dir, languages=[dir_name])
			available_languages[iso_code] = t
		except IOError:
			log.error("language '%s' not available", language)
			return False
	t.install(unicode=True, names=['ngettext'])
	return None

def init():
	gettext.install(application, locale_dir, unicode=True, names=['ngettext'])

init()
log.info(_('Internationalisation loaded.'))
def omnicode(txt):
	if isinstance(txt, unicode):
		pass
	else:
		if isinstance(txt, basestring):
			pass
	return unicode(txt)

class UnicodeDict(dict):
	__doc__ = "\n    Dict that handle (key : i18n value).\n    All the values are evaluated (ie i18n'ed) at each dict access\n    "
	def __getitem__(self, key):
		if isinstance(key, basestring) and key.startswith('raw_'):
			if key in self:
				pass
			return dict.__getitem__(self, key[4:])
		else:
			return _(dict.__getitem__(self, key))

	def get(self, key, default=None):
		if isinstance(key, basestring) and key.startswith('raw_'):
			if key in self:
				pass
			return dict.get(self, key[4:], default)
		else:
			return _(dict.get(self, key, default))

	def items(self):
		pass



Y_M_D, D_M_Y, M_D_Y = xrange(3)
_DATE_FORMAT_MAPPING = {Y_M_D: '%Y/%m/%d', D_M_Y: '%d/%m/%Y', M_D_Y: '%m/%d/%Y'}
def get_date_format():
	df = user_config['base']['dateformat']
	return _DATE_FORMAT_MAPPING.get(df, '%Y/%m/%d')

def get_time_format():
	if user_config['base']['timeformat']:
		pass
	return '%I:%M %p'

__all__ = ['set_language', 'available_languages', 'omnicode', 'UnicodeDict', 'get_date_format', 'get_time_format', 'Y_M_D', 'D_M_Y', 'M_D_Y']
